home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / tjgold.zip / INSTALL.004 / FGUSER11.TXT < prev    next >
Text File  |  1995-05-29  |  27KB  |  643 lines

  1.                                Pull-Down Menus
  2.  
  3.                                   "Bell, book, and  candle shall not
  4.                                    drive me back, when gold and silver
  5.                                    becks me to come on."
  6.                                                King John, Shakespeare
  7.  
  8. Introduction
  9.  
  10.           We are excited. The pull-down menu features offered in Gold
  11.      are the most flexible and easy to use in the market place. In this
  12.      chapter you will learn about the following features of Gold's
  13.      pull-down menus and status bars:
  14.  
  15.           Multiple menu styles are supported, including traditional,
  16.           chiseled, and a Microsoft Windows look-alike.
  17.  
  18.           Pull-down menus support keyboard, mouse and hotkey input.
  19.  
  20.           Menus can be nested many levels deep.
  21.  
  22.           Separators and grayed items can be easily incorporated.
  23.  
  24.  
  25.      Figure 11.1
  26.      A Pull-Down Menu
  27.      with a
  28.      Status Bar
  29.  
  30. The Architecture of a Pull-Down Menu
  31.  
  32.           A pull-down menu is actually a collection of separate menus
  33.      bound together. There is always one menu bar in a pull-down menu,
  34.      even if there is only one item on the bar. The menu bar defines the
  35.      menu items which appear across the top of the pull-down menu, i.e.
  36.      the items which are visible even when the menu is inactive.
  37.  
  38.           Each item on the menu bar usually has a pop-up menu item
  39.      defined. Any item in a pop-up menu can point to another pop-up menu
  40.      thereby providing multiple levels of sub-menus.
  41.  
  42.           This scheme of combining a menu bar with several pop-up menus
  43.      to create a pull-down menu is illustrated in Figure 11.2.
  44.  
  45.  
  46. Building a Pull-Down menu
  47.  
  48.           Enough theory; let's create a menu. Creating a menu is like
  49.      baking a cake, all you need to do is follow the recipe:
  50.  
  51.          Declare the menu variables
  52.          Construct a menu bar with at least one item.
  53.          Construct as many pop-up menus as you need.
  54.          Activate the menu when a menu key is pressed in the application.
  55.          Call a sub-routine based on the user's menu selection.
  56.  
  57. Creating Menu Variables
  58.  
  59.           Every pull-down menu has one menu bar. The menu bar is defined
  60.      in a variable of type Bar. Additionally, there is one pop-up menu
  61.      for each menu bar which has related options. Each menu pop-up is
  62.      define in a variable of type PopUp.
  63.  
  64.           The following declaration is extracted from DEMPLL2.PAS which
  65.      defines a pull-down menu with two items on the menu bar, and two
  66.      pop-up menus.
  67.  
  68.           var
  69.              MainMenu: Bar;
  70.              FileMenu: PopUp;
  71.              OptionsMenu: PopUp;
  72.  
  73. Constructing the Menu Bar
  74.  
  75.           A variable of type Bar defines the content of the menu bar. To
  76.      construct a menu bar, the menu bar must first be initialized with
  77.      the InitBar procedure, and then items are added to the menu bar
  78.      with the BarAddItem procedure. These two procedures are defined as
  79.      follows:
  80.  
  81.      InitBar(var P: Bar);
  82.  
  83.           Sets a menu bar to the default values. This procedure must be
  84.      called prior to calling BarAddItem. The procedure is passed the
  85.      menu bar variable that will be initialized.
  86.  
  87.      BarAddItem(var M: Bar; Item:string; ID:integer; HK,AltHK:word;
  88.                                            Desc:string; PopUp:pointer);
  89.  
  90.           Adds an item to the menu bar. The procedure is passed the menu
  91.      bar variable, the text of the menu bar entry, the ID that will be
  92.      returned when the user presses help or selects the menu item, two
  93.      hotkeys (discussed below), the long description, and finally a
  94.      pointer to a pop-menu variable (if a pop-up is to be displayed when
  95.      the menu bar item is selected).
  96.  
  97. Managing Hotkeys
  98.  
  99.           There are many different ways that a user can make a choice
  100.      from a pull-down menu: using the cursor keys to select an item and
  101.      pressing Enter, using the mouse and double-clicking on the menu
  102.      item, or pressing a hotkey. Gold supports three different levels of
  103.      hotkey.
  104.  
  105.           As defined above, BarAddItem accepts two hotkey arguments. The
  106.      first hotkey is the upper-case letter that can be pressed when the
  107.      menu bar is active and the pop-up menus are not displayed. (This
  108.      state occurs when you press F10 in the BP7 environment.) If you
  109.      press the appropriate letter, Gold will jump to the menu item which
  110.      was defined with that hotkey.
  111.  
  112.           The second hotkey passed to BarAddItem defines an alternate
  113.      key which can be pressed whenever a pop-up is displayed (no matter
  114.      how nested). The de facto standard is to use an Alt-letter key
  115.      sequence for the second hotkey.
  116.  
  117.           For example, the a menu item define as "File" might have the
  118.      letter F as the first hot key (70) and Alt-F as the second hotkey
  119.      (289).
  120.  
  121.           To visibly indicate to the user which letter is the hotkey
  122.      letter, use the "~" character to instruct gold to highlight the
  123.      letter, e.g. '~F~ile'. This technique works for the menu bar items
  124.      as well as pop-up items.
  125.  
  126.           The third type of hotkey is defined globally and is not
  127.      directly associated with a specific menu item. For example, in BP7,
  128.      the File Open menu item is the hotkey F2.  To define these
  129.      additional hotkeys, use the procedure BarAddHK which is defined as
  130.      follows:
  131.  
  132.      BarAddHK(var P: Bar; K:word; HotID:integer);
  133.  
  134.           Defines a general hotkey. The procedure is passed the menu bar
  135.      variable, the hotkey, and the ID which will be returned when the
  136.      hotkey is pressed.
  137.  
  138. Example
  139.  
  140.           Listed below is an extract from DEMPLL2.PAS which initializes
  141.      a two item menu bar and defines some extra hotkeys:
  142.  
  143.           procedure DefineMainMenu;
  144.           {}
  145.           begin
  146.              InitBar(MainMenu);
  147.              BarAddItem(MainMenu,'~F~ile',100,70,289,
  148.                         'File management commands (open, new,
  149.                         etc).',@FileMenu);
  150.              BarAddItem(MainMenu,'~O~ptions',800,79,280,
  151.                         'Set defaults for compiler, editor,
  152.                         mouse, debugger, etc.',@OptionsMenu);
  153.              BarAddHK(MainMenu,317,102); {F3 - File Open}
  154.              BarAddHK(MainMenu,316,103); {F2 - File Save}
  155.              BarAddHK(MainMenu,301,110); {Alt-X - quit}
  156.           end; { DefineMainMenu }
  157.  
  158.           Notice that the last argument on the File menu constructor is
  159.      @FileMenu. This informs Gold that the pop-up menu FileMenu should
  160.      be displayed when the user selects File from the main menu bar.
  161.      Similarly, the Options menu bar item will call the pop-up
  162.      OptionsMenu.
  163.  
  164. Constructing the Menu Pop-Ups
  165.  
  166.           The process of constructing a pop-up menu is very similar to
  167.      the process just described for menu bars. A variable of type PopUp
  168.      defines the content of the pop-up menu. To construct a pop-up menu,
  169.      the menu must first be initialized with the InitPopUp procedure,
  170.      and then items are added to the menu with the PopUpAddItem
  171.      procedure. These two procedure are defined as follows:
  172.  
  173.      InitPopup(var M:PopUp);
  174.  
  175.           Sets a pop-up menu to the default values. This procedure must
  176.      be called prior to calling PopUpAddItem. The procedure is passed
  177.      the popup menu variable that is to be initialized.
  178.  
  179.      PopupAddItem(var P:PopUp;Item:string; ID:integer; HK:word;
  180.                                        Desc:string; ChildMenu:pointer);
  181.  
  182.           Adds an item to the menu. The procedure is passed the pop-up
  183.      menu variable, the text of the menu item, the ID that will be
  184.      returned when the user presses help or selects the menu item, a
  185.      hotkey which can be used to select the item when the pop-up has
  186.      focus, the long description, and finally a pointer to another popup
  187.      variable if a pop-up is to be displayed when the menu  item is
  188.      selected -- pass nil if there is no submenu.
  189.  
  190.  
  191.           Listed below is a PopupAddItem statement which defines the
  192.      "New " item on a file menu:
  193.  
  194.      PopUpAddItem(FileMenu,'~N~ew',101,78,'Create a new file in a new
  195.                                                      Edit window',nil);
  196.  
  197. Defining Separators, Grayed Items and Right Justified Text
  198.  
  199.           By adding some reserved characters to the item text, you can
  200.      exert additional control over the item format.
  201.  
  202.           Adding a Separator -- if the menu text is defined as a single
  203.      minus character "-", Gold will insert a menu separator instead of a
  204.      normal item. The other parameters are ignored, and can be set to
  205.      nulls. For example:
  206.  
  207.      PopUpAddItem(FileMenu,'-',0,0,'',nil);
  208.  
  209.           Graying an Item -- later you will read about the SetActive
  210.      procedures for making items grayed or selectable. An easy way to
  211.      make a menu item non-selectable is to insert the exclamation
  212.      character "!" in the first character of the item text. For example:
  213.  
  214.      PopUpAddItem(EditMenu,'!~R~edo',202,82,'Redo the previously undone
  215.                                                  editor operation',nil);
  216.  
  217.           Right Justifying Text -- Traditionally, global hotkeys are
  218.      displayed right  justified in the text of the menu item. To save
  219.      you the chore of entering the correct number of spaces to right
  220.      justify the hot key description, simply insert a colon ":" in the
  221.      item text. All characters to the right of the colon will be right
  222.      justified.
  223.  
  224.      PopUpAddItem(FileMenu,'E~x~it:Alt-X',110,88,'~Exit~ Turbo
  225.                                                          Pascal',nil);
  226.  
  227. Example
  228.  
  229.           The following extract from DEMPLL2.PAS illustrates all the
  230.      above techniques, and shows how a file menu might be defined:
  231.  
  232.           procedure DefineFilePopUp;
  233.           {}
  234.           begin
  235.              InitPopUp(FileMenu);
  236.              PopUpAddItem(FileMenu,'~N~ew',101,78,'Create a new
  237.                           file in a new Edit window',nil);
  238.              PopUpAddItem(FileMenu,'~O~pen...:F3',102,79,'Locate
  239.                           and open in an Edit window',nil);
  240.              PopUpAddItem(FileMenu,'~S~ave:F2',103,83,'Save the
  241.                           file in the active Edit window',nil);
  242.              PopUpAddItem(FileMenu,'Save ~a~s...',104,65,'Save
  243.                           the current file under a different name
  244.                           directory or drive',nil);
  245.              PopUpAddItem(FileMenu,'Save a~l~l',105,76,'Save all
  246.                           modified files',nil);
  247.              PopUpAddItem(FileMenu,'-',0,0,'',nil); {separator}
  248.              PopUpAddItem(FileMenu,'~C~hange dir...',106,67,
  249.                           'Choose a new default directory',nil);
  250.              PopUpAddItem(FileMenu,'~P~rint',107,80,'Print the co
  251.                           ntents of the active Edit window',nil);
  252.              PopUpAddItem(FileMenu,'P~r~inter setup',108,82,                     'Choose printer filter to
  253.                           use for printing',nil);
  254.              PopUpAddItem(FileMenu,'~D~os shell',109,68,
  255.                           'Temporily exit to DOS',nil);
  256.              PopUpAddItem(FileMenu,'E~x~it:Alt-X',110,88,'~Exit~
  257.                           Turbo Pascal',nil);
  258.           end; { DefineFilePopUp }
  259.  
  260.  
  261.           Look at the demo files DEMPLL1.PAS through DEMPLL4.PAS to see
  262.      more examples of menu constructions.
  263.  
  264. Activating a Pull-Down Menu
  265.  
  266.           The GOLDDESK unit provides a very powerful and flexible way of
  267.      managing input to an application using a "desktop" just like the
  268.      desktop used in BP7. If you have not used a desktop, consider
  269.      reading the next chapter before deciding to roll-your-own desktop
  270.      using the primary menu input functions. You will probably find that
  271.      the desktop meets all of your needs (and then some).
  272.  
  273.           Gold, however, does not force you to use the desktop. You can
  274.      always manage input to the application yourself and pass
  275.      menu-related keystrokes to the menu for processing. This section
  276.      describes how.
  277.  
  278. Invoking the Menu
  279.  
  280.           The simplest way to pass control to the menu is to call the
  281.      function ActivatePullmenu. The function is passed the menu bar
  282.      variable and returns an integer indicating the users selection. For
  283.      example:
  284.  
  285.      Choice := ActivatePullmenu(MainMenu);
  286.  
  287.           If the user escaped from the menu without making a selection,
  288.      a zero is returned.
  289.  
  290. Passing keystrokes to the Menu
  291.  
  292.           If a pull-down menu is to form the main task manager for an
  293.      application, the menu display functions should be placed inside a
  294.      loop that prompts the user to make a menu selection and then
  295.      responds to the selection (usually in the form of a case
  296.      statement).
  297.  
  298.           The GOLDMENU unit includes the function IsPullkey which is
  299.      passed the menu variable along with Gold's standard three entries
  300.      which define a keystroke, i.e. the key, and the mouse X,Y
  301.      coordinates. The function returns true if the input should be
  302.      handled by the pull-down menu. When a true is returned, the
  303.      application should pass the keystroke to the menu using the
  304.      PullPushKey function -- this function simply instructs Gold to
  305.      process the passed keystroke rather than wait for new user input.
  306.  
  307.      The following code fragment illustrates this basic technique:
  308.  
  309.           with KeyVars do
  310.              repeat
  311.                 GetInput;
  312.                 if IsPullKey(MainMenu,LastKey,LastX,LastY) then
  313.                 begin
  314.                    Choice := PullPushKey(MainMenu,LastKey,LastX,
  315.                                           LastY);
  316.                    case Choice of
  317.                       101:;
  318.                       102:;
  319.                       103:;
  320.                       ........
  321.                     end; {case}
  322.  
  323.                 end;
  324.              until Choice = 999;
  325.  
  326.           The following example is an extract of DEMPLL3.PAS which uses
  327.      the plain ActivateMenu function if the user presses the slash key
  328.      or F10, and uses PullPushkey if the input is menu related.
  329.  
  330.           DefineMenus;
  331.           DrawBar(MainMenu);
  332.           MouseShow(true);
  333.           CursorOff;
  334.           repeat
  335.              Choice := 0;
  336.              GetInput;
  337.              with KeyVars do
  338.              begin
  339.                if (LastKey = 47) {/}
  340.                or (LastKey = 324) {F10} then
  341.                   Choice := ActivatePullMenu(mainmenu)
  342.                else if IsPullKey(MainMenu, LastKey, LastX, LastY) then
  343.                   Choice := PullPushKey(MainMenu, LastKey, LastX,LastY);
  344.                case choice of
  345.                   101:;  {call the appropriate functions}
  346.                   102:;
  347.                end;
  348.                if (Choice <> 0) and (Choice <> 110) then
  349.                   PromptOK(' Gold ','You chose menu ID '+
  350.                                                   IntToStr(Choice));
  351.              end;
  352.           until Choice = 110; {the exit choice}
  353.           MouseShow(false);
  354.           DisposeMenus;
  355.  
  356.           Don't forget that the desktop can take care of all of this
  357.      input code for you. Further details are provided in the next
  358.      chapter.
  359.  
  360. Disposing of Menu Memory
  361.  
  362.           The menu bar and the menu pop-ups use memory on the heap to
  363.      store the menu details. When a menu is no longer required, the menu
  364.      structures must be disposed of by calling DestroyBar and
  365.      DestroyPopup. The following code is taken from DEMPLL3.PAS:
  366.  
  367.           procedure DisposeMenus;
  368.           {}
  369.           begin
  370.              DestroyBar(MainMenu);
  371.              DestroyPopUp(FileMenu);
  372.              DestroyPopUp(OptionsMenu);
  373.              DestroyPopUp(EnvironmentMenu);
  374.           end; { DisposeMenus }
  375.  
  376. Customizing the Menu's Appearance
  377.  
  378.           Like many other Gold offerings, menus use industry standard
  379.      defaults to make it easy to create a professional and contemporary
  380.      application. However, various aspects of the menus can be
  381.      customized to meet individual tastes.
  382.  
  383. Customizing the Menu Style
  384.  
  385.           The most dramatic way to change the overall menu appearance is
  386.      to change the menu style. The menu bar variable is actually a
  387.      record which contains a field named Style. The Style variable can
  388.      have any value in the range 1 to 4 as follows:
  389.  
  390.           Style  Description
  391.  
  392.           1      A BP7-style menu with a single line border.
  393.           2      Similar to style 1, but the pop-up menu borders have a
  394.                  chiseled affect. This is the default style.
  395.           3      This style takes advantage of Gold's custom characters,
  396.                  and draws window borders along the outermost edge of
  397.                  the pop-ups.
  398.           4      Draws a Microsoft Windows look-alike. This style can
  399.                  take advantage of Gold's custom characters.
  400.  
  401.           The default menu style is defined by the variable
  402.      MenuVars.PullStyle. -- its value is assigned to a menu bar when it
  403.      is initialized.
  404.  
  405.           You can experiment with the menu styles by running DEMPLL4.PAS
  406.      and modifying the Mainmenu.Style value.
  407.  
  408. Customizing Menu Colors
  409.  
  410.           You guessed it, you can customize any of the menu colors by
  411.      calling GoldSetColor. The following elements of TINT affect the
  412.      menu colors:
  413.  
  414.           PullHiHot
  415.           PullHi
  416.           PullNormHot
  417.           PullNorm
  418.           PullOff
  419.           PullMsgHot
  420.           PullMsg
  421.           PullBorder1
  422.           PullBorder2
  423.  
  424.           The following code is an extract from DEMCAL5.PAS which
  425.      customizes the menu colors:
  426.  
  427.           procedure CustomizeColors;
  428.           {}
  429.           begin
  430.              GoldSetColor(PullHiHot,YellowOnBlue);
  431.              GoldSetColor(PullHi,WhiteOnBlue);
  432.              GoldSetColor(PullNormHot,YellowOnMagenta);
  433.              GoldSetColor(PullNorm,WhiteOnMagenta);
  434.              GoldSetColor(PullOff,LightgrayOnMagenta);
  435.              GoldSetColor(PullMsgHot,YellowonMagenta);
  436.              GoldSetColor(PullMsg,WhiteonMagenta);
  437.              GoldSetColor(PullBorder1,BlackOnmagenta);
  438.              GoldSetColor(PullBorder2,CyanOnMagenta);
  439.           end; { CustomizeColors }
  440.  
  441. Customizing Other Menu Components
  442.  
  443.           A menu bar (record) variable contains additional fields
  444.      allowing you to customize the menu bar location, the long prompt
  445.      location, as well as optional characters used to designate special
  446.      items and highlight the active item.
  447.  
  448. Controlling the Menu Location
  449.  
  450.           It is normal for the menu to occupy the top row of the screen
  451.      (or the top two rows for the Windows-style menu). However you can
  452.      position the menu where you want. The menu bar variables TopX and
  453.      TopY identify the location of the top left of the main menu bar.
  454.      When a menu bar is initialized, with InitBar, the values of TopX
  455.      and TopY are set to 1.
  456.  
  457. Controlling the Message Location
  458.  
  459.           By default, the long description of the highlighted topic is
  460.      displayed at the bottom of the display. The message location can be
  461.      controlled by modifying the following fields of the menu bar
  462.      record: DescX1, DescX2 and DescY. These control the starting column
  463.      of the long description, the ending column of the long description,
  464.      and the row on which the description will be displayed.
  465.  
  466.           If you are using a menu style of 4, the menu description
  467.      should be displayed on the top of the screen. The following extract
  468.      from DEMPLL4.PAS shows how to adjust the message location for
  469.      various styles:
  470.  
  471.         if MainMenu.Style = 4 then
  472.         begin
  473.            ClearLine(1,WhiteOnBlue);
  474.            ClearLine(2,BlackOnLightgray);
  475.            MainMenu.DescX1 := 4;
  476.            MainMenu.DescX2 := 80;
  477.            MainMenu.DescY := 1;
  478.            GoldSetColor(PullMsgHot, whiteonblue);
  479.            GoldSetColor(PullMsg, lightgrayonblue);
  480.         end
  481.  
  482. Redefining Menu Display Characters
  483.  
  484.           Earlier you learned that if the item text was a minus sign a
  485.      separator would be inserted in the pop-up. You also learned that an
  486.      item starting with an exclamation would be initially
  487.      non-selectable, and any text to the right of a colon would be right
  488.      justified.
  489.  
  490.           These special characters are not hard coded, and can be
  491.      configured to use other characters. To change the characters,
  492.      simply assign new values to the following three variables:
  493.      MenuVars.Separator, MenuVars.InActiveChar and MenuVars.TabChar.
  494.  
  495.           By assigning different characters to the variables
  496.      MenuVars.PullLeft and MenuVars.PullRight you can make the active
  497.      (or highlighted) item standout more clearly.
  498.  
  499.           Finally, the character used to indicate that an item has a
  500.      sub-menu defaults to a right pointing chevron. You can use a
  501.      different character by assigning a new character value to the
  502.      MenuVars.PullSubIndicator variable.
  503.  
  504. Adding Menu Help
  505.  
  506.           You can instruct Gold to call a custom help procedure to
  507.      provide menu context sensitive help. All you have to do is create a
  508.      procedure following some specific rules and call the procedure
  509.      AssignMenuHelpHook to instruct Gold to call your procedure every
  510.      time the user requests help while the menu has focus.
  511.  
  512.           For a procedure to be eligible as a menu help hook it must
  513.      adhere to the following rules:
  514.  
  515.           The procedure must be declared as a far procedure at the root
  516.           level. Refer to the section Understanding Hooks in chapter 3
  517.           for further information.
  518.  
  519.           The procedure must be declared with one parameter of type
  520.           integer. This variable identifies the ID of the active item at
  521.           the time the user requested help.
  522.  
  523.      The following procedure declaration follows these rules:
  524.  
  525.           {$F+}
  526.           procedure MenuHelp(ID:integer);
  527.           {}
  528.           begin
  529.              PromptOK(' Help! ','You asked for help on item ID: '
  530.                        +IntToStr(ID));
  531.           end; { MenuHelp }
  532.           {$F-}
  533.  
  534.           The following procedure is then called to instruct Gold to
  535.      call your procedure after each input:
  536.  
  537.      AssignMenuHelpHook(var M: Bar; Proc:PullHook);;
  538.  
  539.           Instructs Gold to call the specified procedure when the user
  540.      requests help during menu selection.
  541.  
  542.           When a help hook is implemented, Gold automatically adds a
  543.      help string to the long description line, i.e. at coordinates
  544.      (MenuVars.DescX1, MenuVars.MsgY). The user can click on this area
  545.      with the mouse, to access the help.
  546.  
  547.           International users note that the actual text of the help
  548.      string is defined in the variable MenuVars.HelpStr and can be
  549.      modified as necessary. By default the help key is F1; this too can
  550.      be customized -- just assign an new keystroke value to the variable
  551.      MenuVars.HelpKey.
  552.  
  553.           If, subsequently, you want to remove the help hook, call the
  554.      procedure RemoveMenuHelpHook.
  555.  
  556.           The demo file DEMPLL4.PAS shows how a help hook can be added
  557.      to a pull-down menu.
  558.  
  559. Utilizing Menu Hind Hooks
  560.  
  561.           If you want to write some additional information to the screen
  562.      based on the active menu item, you should take advantage of the
  563.      pull-down menu's hind hook. A hind hook is called once when the
  564.      menu is first displayed, and every time a keystroke or mouse click
  565.      is processed by the menu.
  566.  
  567.           For a procedure to be eligible as a pull-down menu hind hook
  568.      it must adhere to the following rules:
  569.  
  570.           The procedure must be declared as a far procedure at the root
  571.           level. Refer to the section Understanding Hooks in chapter 3
  572.           for further information.
  573.  
  574.           The procedure must be declared with one parameter of type
  575.           integer. This variable identifies the ID of the active item.
  576.  
  577.           Just like the help hook described above, the hind hook can be
  578.      assigned and removed using AssignMenuHindHook and
  579.      RemoveMenuHindHook, respectively.
  580.  
  581. Changing Menu Settings On-The-Fly
  582.  
  583.           Typically, you will create a pull-down menu when the
  584.      application is started, and destroy the menu when the application
  585.      is closed. During the session, you can change the look and feel of
  586.      the menu (without having to destroy and rebuild the menu) by using
  587.      the following procedures:
  588.  
  589.      BarSetActive(var M: Bar; ID:integer; On: boolean);
  590.  
  591.           Makes a menu bar item active or inactive.
  592.  
  593.      BarChangeItem(var M: Bar; ID:integer; Item,Desc:string;
  594.                        HK,AltHK:word; NewID:integer; PopUp:pointer);
  595.  
  596.           Redefines all the components of a menu bar item.
  597.  
  598.      BarChangeText(var M: Bar; ID:integer; Item,Desc:string);
  599.  
  600.           Redefines the short and long descriptions of a menu bar item.
  601.  
  602.      BarDelItem(var M: Bar; ID:integer);
  603.  
  604.           Removes an item from a menu bar.
  605.  
  606.      BarDelHK(var P: Bar; K:word);
  607.  
  608.           Removes a global hot key.
  609.  
  610.      PopUpSetActive(var P:PopUp; ID:integer; On: boolean);
  611.  
  612.      Makes a pop-up menu item active or inactive.
  613.  
  614.      PopUpChangeItem(var P:PopUp; ID:integer; Item,Desc:string;HK:word;
  615.                                      NewID:integer; ChildMenu:pointer);
  616.  
  617.           Redefines all the components of a pop-up menu item.
  618.  
  619.      PopUpChangeText(var P:PopUp; ID:integer; Item,Desc:string);
  620.  
  621.           Redefines the short and long descriptions of a pop-up menu
  622.      item.
  623.  
  624.      PopUpDelItem(var P:PopUp; ID:integer);
  625.  
  626.           Removes an item from a pop-up menu.
  627.  
  628. Managing Status Bars
  629.  
  630.           The good news is that you already know how to create a status
  631.      bar. A Status bar is actually a menu bar positioned at the bottom
  632.      of the screen. You'll learn more about status bars in the next
  633.      chapter.
  634.  
  635.      Error Management
  636.  
  637.           The pull down menu structures allocate memory on the heap and
  638.      so have the potential to fail. For example, there may be
  639.      insufficient free memory to add a menu bar or pop-up item. After
  640.      calling the BarAddItem and PopupAddItem procedures be sure to call
  641.      the function LastMenuError to see if the item addition was
  642.      successful.
  643.